package scuts.core;





class Curry2 {
	public static function curry < A, B, C > (f:A->B->C, a:A):A->(B->C)
	{
		return function (a:A) 
      return function (b:B) return f(a, b);
	}

	public static function uncurry <A,B,C>(f:A->(B->C)):A->B->C
	{
		return function (a:A, b:B) return f(a)(b);
	}
}

class Curry3 {
	public static function curry < A, B, C, D > (f:A->B->C->D, a:A):A->(B->(C->D))
	{
		return function (a:A) 
      return function (b:B) 
        return function(c:C) return f(a, b, c);
	}
	
	public static function uncurry <A,B,C,D>(f:A->(B->(C->D))):A->B->C->D
	{
		return function (a,b,c) return f(a)(b)(c);
	}
}

class Curry4 {
	public static function curry < A, B, C, D, Z > (f:A->B->C->D->Z, a:A):A->(B->(C->(D->Z)))
	{
		return function (a:A) 
      return function (b:B) 
        return function(c:C) 
          return function(d:D) 
            return f(a, b, c,d);
	}

	public static function uncurry <A,B,C,D, Z>(f:A->(B->(C->(D->Z)))):A->B->C->D->Z
	{
		return function (a,b,c,d) return f(a)(b)(c)(d);
	}
}